package info.motteke.kurumi.swt;

import info.motteke.util.MixiVoiceProperties;

import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Shell;

/* package */class ShellResizeListener extends ControlAdapter {

    private final Shell shell;

    private final MixiVoiceProperties prop;

    public ShellResizeListener(Shell shell) {
        this.shell = shell;
        prop = MixiVoiceProperties.getInstance();
    }

    @Override
    public void controlResized(ControlEvent e) {
        Point size = shell.getSize();
        prop.setWindowWidth(size.x);
        prop.setWindowHeight(size.y);
    }
}
